/*
 * @Author: zheguo 3188606474@qq.com
 * @Date: 2024-04-22 08:18:52
 * @LastEditors: zheguo 3188606474@qq.com
 * @LastEditTime: 2024-04-22 08:22:22
 * @FilePath: \projectOne\myapp\src\utils\filterArray.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
function filterArray(datalist){
    var adressArr = [...new Set([...new Set(datalist.map(item => {
        let arr = []
        arr.push(item.address)
        return arr
    }))].flat())]

    var resultArr = []
    for (var i = 0; i < adressArr.length; i++) {

        let obj = {}

        obj.name = adressArr[i]

        obj.value = datalist.filter(item => {
            if (item.address == adressArr[i]) {
                return item.id
            }
        }).length

        resultArr.push(obj)


    }

    return resultArr
}

export default filterArray